﻿using System.Collections.Generic;
using NUnit.Framework;
using ValidationFramework.Tests.Performance.TestHelpers;

namespace ValidationFramework.Tests.Performance
{
	[TestFixture]
	public class ValidationManagerTests
	{
		public class ClassToValidate
		{
			public int PropertyToValidate
			{
				get;
				set;
			}
		}
#if (!WindowsCE)
		[Test]
		public void Overhead_From_Using_ValidationManager_To_Validate()
		{
			// Arrange
			var classToValidate = new ClassToValidate { PropertyToValidate = 10 };
			const string memberName = "PropertyToValidate";

			// Act
			const int iterations = 10000;
			var options = new ValidationOptions();
			var policies = new List<IValidationPolicy>() { new FakeValidationPolicy(memberName, null, null) };
			var validationManager = new MemberValidationManager(classToValidate, policies);
				
			using (var disposableStopwatch = new DisposableStopwatch("Validate Valid Property using string", iterations))
			{
				disposableStopwatch.Run(() => validationManager.Validate(memberName));
			}
		}
#endif
	}
}
